/** <a href="http://www.cpupk.com/decompiler">Eclipse Class Decompiler</a> plugin, Copyright (c) 2017 Chen Chao. */
package com.ffcs.crmd.tsp.common.job.entity;
import java.util.Map;

import com.ffcs.crmd.tsp.common.base.BaseJobDataMap;
import com.thoughtworks.xstream.annotations.XStreamAliasType;

/**
 * 
 * 功能说明:任务参数数据类
 *
 * @author ZHONGFUHUA
 * 
 * @see com.ffcs.crmd.tsp.api.dto.task.TspJobDataMap
 */
@XStreamAliasType("TspJobDataMap")
@Deprecated
public class TspJobDataMap extends BaseJobDataMap<String, Object> {
    
    public TspJobDataMap() {
        super();
    }
    
    public TspJobDataMap(Map<String, Object> map) {
        super(map);
    }
    
    // -----------------   put convert ---------------------
    
    public void putAsString(String key, String value) {
        super.put(key, value);
    }
    
    public void putAsString(String key, boolean value) {
        String strValue = Boolean.valueOf(value).toString();
        super.put(key, strValue);
    }
    
    public void putAsString(String key, char value) {
        String strValue = Character.valueOf(value).toString();
        super.put(key, strValue);
    }
    
    public void putAsString(String key, double value) {
        String strValue = Double.toString(value);
        super.put(key, strValue);
    }
    
    public void putAsString(String key, float value) {
        String strValue = Float.toString(value);
        super.put(key, strValue);
    }
    
    public void putAsString(String key, int value) {
        String strValue = Integer.valueOf(value).toString();
        super.put(key, strValue);
    }
    
    public void putAsString(String key, long value) {
        String strValue = Long.valueOf(value).toString();
        super.put(key, strValue);
    }
    
    // -----------------   get convert ---------------------
    
    public String getStringFromString(String key) {
        Object obj = get(key);
        return String.valueOf(obj);
    }
    
    public int getIntFromString(String key) {
        Object obj = get(key);
        return new Integer((String) obj).intValue();
    }
    
    public boolean getBooleanValueFromString(String key) {
        Object obj = get(key);
        return Boolean.valueOf((String) obj).booleanValue();
    }
    
    public char getCharFromString(String key) {
        Object obj = get(key);
        return ((String) obj).charAt(0);
    }
    
    public double getDoubleValueFromString(String key) {
        Object obj = get(key);
        return Double.valueOf((String) obj).doubleValue();
    }
    
    public float getFloatValueFromString(String key) {
        Object obj = get(key);
        return new Float((String) obj).floatValue();
    }
    
    public long getLongValueFromString(String key) {
        Object obj = get(key);
        return new Long((String) obj).longValue();
    }
}
